package com.umeox.watch.moto.dataservice.db.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.umeox.watch.moto.dataservice.db.model.HolderInfo;

import java.util.List;

/**
 * Created by Rambo 2021/9/18
 * Describe:
 */
@Dao
public interface HolderInfoDao {

    @Query("SELECT * FROM holder_info WHERE deviceId=:deviceId")
    HolderInfo queryByDeviceId(String deviceId);

    @Query("SELECT * FROM holder_info")
    List<HolderInfo> loadAll();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long save(HolderInfo holderInfo);

    @Delete
    void delete(HolderInfo holderInfo);

    @Query("DELETE FROM holder_info")
    int deleteAll();

    @Query("SELECT holderId FROM holder_info")
    String getHolderId();

}
